NOTES FOR XMAIL RAW MESSAGES
See the four files in "examples" for different kinds of emails and how are they composed.

You can use this code to test'em:

#################################
set rawSource to (read alias "path:to:examples:plaintext.txt")

send raw mail to {"whoever@host.com"} from "whoever@host.net" raw source rawSource SMTP server "smtp.host.net" username "user" password "pwd" authentication auto
#################################

Composing the message is very easy. Just take a look to the examples. But, just in case, I'll tell you how you will create a special formatted date for messages, and how you can encode a file in base64 format, suitable to create your attachments for "XMail raw messages":

1. Compose date for a raw message:
set GMTDiff to (time to GMT) / 3600 as integer
if GMTDiff < 0 then
	set GMTDiff to "-" & text -2 thru -1 of ("00" & (text 2 thru -1 of (GMTDiff as text))) & "00"
else
	set GMTDiff to "+" & text -2 thru -1 of ("00" & GMTDiff as text) & "00"
end if

set emailDate to (do shell script "date '+%a, %e %b %Y %H:%M:%S " & GMTDiff & "'")

2. Convert file to base64 attachment:
do shell script "openssl base64 < " & quoted form of POSIX path of alias "path:to:file.jpg"

--> You can also write the base64 data to a external file and use it later

do shell script "openssl base64 < " & (quoted form of POSIX path of alias "path:to:file.jpg") & " > /tmp/output.txt"
--> Here we stored file.jpg as base64 in the temp file /tmp/output.txt, which you can read later or whatever,
--> instead of returning it immediatelly as the result of your "do shell script"